package com.xlhj.boot.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author: liucaijing
 * @description: DirectListener
 * @date: 2021/10/20 9:03
 */
@Component
public class DirectListener {

    private static final String DIRECT_QUEUE_NAME = "direct-queue";
    private static Logger logger = LoggerFactory.getLogger(DirectListener.class);

    @RabbitListener(queues = DIRECT_QUEUE_NAME)
    public void receiveMsg(Message message) {
        String msg = new String(message.getBody());
        logger.info("接收到队列direct.queue消息：{}", msg);
    }
}
